package com.example.myapplication;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.example.myapplication.model.Order;
import com.example.myapplication.model.OrderAdapter;

import java.util.ArrayList;
import java.util.List;

public class OrderFragment extends Fragment {
    private RecyclerView rv_order;
    private List<Order> list = new ArrayList<>();
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.order_layout, container, false);
        rv_order = view.findViewById(R.id.rv_order);

        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext());
        rv_order.setLayoutManager(linearLayoutManager);
        Order order  = new Order("1234312412341", 30);
        list.add(order);


        OrderAdapter orderAdapter = new OrderAdapter(list);
        rv_order.setAdapter(orderAdapter);
        return view;
    }
}
